package com.security.dataprocess.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.security.dataprocess.mapper.AlarmIndicatorDraftMapper;
import com.security.dataprocess.model.AlarmIndicatorDraft;
import com.security.dataprocess.service.IAlarmIndicatorDraftService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 监测点位草稿 服务实现类
 * </p>
 *
 * @author H
 * @since 2022-12-16
 */
@Service
public class AlarmIndicatorDraftServiceImpl extends ServiceImpl<AlarmIndicatorDraftMapper, AlarmIndicatorDraft> implements IAlarmIndicatorDraftService {

    @Override
    public  IPage<AlarmIndicatorDraft> findListByPage(Integer page, Integer pageCount){
        IPage<AlarmIndicatorDraft> wherePage = new Page<>(page, pageCount);
        AlarmIndicatorDraft where = new AlarmIndicatorDraft();

        return   baseMapper.selectPage(wherePage, Wrappers.query(where));
    }

    @Override
    public int add(AlarmIndicatorDraft alarmIndicatorDraft){
        return baseMapper.insert(alarmIndicatorDraft);
    }

    @Override
    public int delete(Long id){
        return baseMapper.deleteById(id);
    }

    @Override
    public int updateData(AlarmIndicatorDraft alarmIndicatorDraft){
        return baseMapper.updateById(alarmIndicatorDraft);
    }

    @Override
    public AlarmIndicatorDraft findById(Long id){
        return  baseMapper.selectById(id);
    }
}
